<template>
  <div>
    <script id="editor" type="text/plain"></script>
  </div>
</template>
<script>
  export default {
    name: 'ue',
    data () {
      return {
        editor: null
      }
    },
    props: {
      value: '',
      config: {}
    },
    methods: {
      getUEContent () {
        return this.editor.getContent()
      },
      init (value) {
        const _this = this
        _this.value = value
        this.editor = window.UE.getEditor('editor', this.config)
        this.editor.addListener('ready', function () {
          _this.editor.setContent(_this.value)
        })
      }
    },
    destroyed () {
      this.editor.destroy()
    }
  }
</script>
